col//title specificationwres_time)wres_tafd)wres_tad)wres_pred)wres_cont)wres_cat)wres_hist)wres_q)cwres_time)cwres_tafd)cwres_tad)cwres_cont)cwres_cat)cwres_hist)cwres_pred)cwres_q)dv_time)
library(pmplots)
library(dplyr)
library(mrggsave)
library(purrr)df <- pmplots_data_obs() %>% mutate(CWRES = CWRESI)
id <- pmplots_data_id()
dayx <- defx(breaks = seq(0,168,24))
.yname <- "NoDoz (ng/mL)"
etas <- c("ETA1//ETA-CL", "ETA2//ETA-V2", "ETA3//ETA-KA")
covs <- c("WT//Weight (kg)", "ALB//Albumin (g/dL)", "SCR//Creatinine (mg/dL)")Override the df and id objects in the above chunk
## Nothing herecol//title specificationThis is a way to specify the column name for source data along with the axis label
col_label("CL//Clearance (L)"). [1] "CL" "Clearance (L)"
When only the column is given, then the column name will be used for the column title:
col_label("WT"). [1] "WT" "WT"
dv_pred)dv_pred(df, yname = .yname)dv_pred(df, loglog=TRUE, yname = .yname)dv_ipred)dv_ipred(df, yname=.yname)dv_ipred(df, loglog=TRUE, yname = .yname)dv_preds(df) %>% mrggdraw(ncol = 2)res_time)res_time(df)res_tafd)res_tafd(df)res_tad)res_tad(df)res_pred)res_pred(df)res_cont)res_cont(df, x="WT//Weight (kg)")This function is also vectorized in x.
c("WT", "CRCL", "AST") %>% map(.f = partial(res_cont,df)) %>% mrggpage %>% mrggdrawres_cat)dplyr::count(df, STUDYc). # A tibble: 4 x 2
. STUDYc n
. <fct> <int>
. 1 SAD 424
. 2 MAD 1199
. 3 Renal 960
. 4 Hepatic 559
res_cat(df, x="STUDYc//Study type")res_hist)res_hist(df)wres_time)wres_time(df) wres_tafd)wres_tafd(df)wres_tad)wres_tad(df)wres_pred)wres_pred(df)wres_cont)This function is also vectorized in x.
wres_cont(df, x="WT//Weight (kg)")wres_cat)wres_cat(df, x="STUDYc//Study type")wres_hist)wres_hist(df)wres_q)wres_q(df)cwres_time)cwres_time(df)cwres_tafd)cwres_tafd(df)cwres_tad)cwres_tad(df)cwres_cont)cwres_cont(df, x="WT//Weight (kg)")Vectorized version
cwres_cont(df, covs) %>%
mrggdraw(ncol = 2)cwres_cat)cwres_cat(df, x="STUDYc//Study type")cwres_cat(df, x="STUDYc//Study type", shown=FALSE)Vectorized version
cwres_cat(df, x = c("STUDYc//Study", "RF//Renal Function")). [[1]]
.
. [[2]]
cwres_hist)cwres_hist(df)cwres_pred)cwres_pred(df)cwres_q)cwres_q(df)npde_time, npde_tad, npde_tafd)npde_time(df)npde_tad)npde_tad(df)npde_tafd)npde_tafd(df)npde_pred)npde_pred(df)npde_cont)npde_cont(df, "WT")npde_cat)npde_cat(df, "STUDYc")npde_q)npde_q(df)npde_hist)npde_hist(df)etas <- c("ETA1//ETA-CL", "ETA2//ETA-V2", "ETA3//ETA-KA")
covs <- c("WT//Weight (kg)", "ALB//Albumin (g/dL)", "SCR//Creatinine (mg/dL)")eta_cont)eta_cont(id, x=covs,y=etas[2]) %>% pm_grid()eta_cont(id, x=covs[1], y=etas) %>%
mrggdraw(ncol = 2)eta_cat)p <- eta_cat(id, x="STUDYc//Study type", y=etas)pm_grid(p)eta_hist)etas <- c("ETA1//ETA-CL", "ETA2//ETA-V2", "ETA3//ETA-KA")
p <- eta_hist(id,etas, bins=10)pm_grid(p)eta_pairs)p <- eta_pairs(id,etas)print(p)dv_time)dv_time(df, yname = .yname)dv_time(df, yname="NoDoze (ng/mL)") +
facet_wrap(~DOSE, scales="free_x")dv_time(df, yname="NoDoze (ng/mL)", log=TRUE) +
facet_wrap(~STUDYc)cont_cat)cont_cat(id, x="STUDYc", y="WT")cont_hist)cont_hist(id, x = "WT", bins = 20)split_plot)p <- split_plot(df, sp="STUDYc", fun=dv_ipred)pm_grid(p)a <- list(trans="log", breaks = logbr3())
dv_time(df, xs=a)dv_time(df, ys=a, yname="Y-axis name")dv_pred(df, smooth=NULL)dv_pred(df, abline=NULL)dv_pred(df, abline=NULL, smooth = NULL)cwres_time(df, hline = NULL)dv_pred(df, add_layers=FALSE)Default breaks:
dv_time(df)Break every 3 days
dv_time(df, xby=72)Custom breaks and limits
a <- list(br = seq(0,240,48), limits=c(0,240))
dv_time(df, xs=a)wres_time(df) + geom_3s()p <- ggplot(df, aes(IPRED,DV)) + geom_point()
pp + pm_theme()p + theme_plain()p + pm_smooth()p + pm_abline()ggplot(df, aes(TIME,CWRES)) + geom_point() + pm_hline()dv_pred(df) + rot_x(angle = 90) + rot_y()